<html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
var t = async_test("Test Blob.size of response blob received for XMLHttpRequest");
t.step(function() {
    var req = new XMLHttpRequest;
    var i = 0;
    // Run the test multiple times using the same XMLHttpRequest instance to
    // check if all states are cleared correctly.
    var doRequest = function() {
        req.open('GET', '../resources/test.ogv', true);
        req.responseType = 'blob';
        req.onreadystatechange = t.step_func(function() {
            if (req.readyState == req.DONE) {
                assert_equals(200, req.status, "Status");
                assert_equals(103746, req.response.size, "Size");
                if (++i < 3)
                    doRequest();
                else
                    t.done();
            }
        });
        req.send(null);
    };
    doRequest();
});
</script>
</body>
